<template>
	<view class="contain">
		<view class="header">
			<view class="logo" v-if="userlogin">
				<image :src="userinfo.faceImages" mode=""></image>
			</view>
			<view class="logo" v-else>
				<image src="http://pic.soutu123.cn/element_origin_min_pic/01/54/05/625746fd5b60878.jpg!/fw/700/quality/90/unsharp/true/compress/true" mode=""></image>
			</view>
			<view class="desc" v-if="userlogin">
				<view class="name">
					{{userinfo.username}}
				</view>
				<view class="idnum">
					ID: {{userinfo.id}}
				</view>
			</view>
			<view class="desc login"  @click="goregister" v-else>
				登录/注册
			</view>
			<view class="setting" v-if="userlogin" @click="setting">
				<image src="../../static/setting.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userlogin:false,
				userinfo:{}
			}
		},
		methods: {
			goregister(){
				uni.navigateTo({
					url:'../register/register',
					
				})
			},
			setting(){
				uni.navigateTo({
					url:'../setting/setting'
				})
			}
		},
		onShow() {
		    var userinfo = this.getGlobalUser("globaluser")
			if(userinfo != null){
				this.userlogin = true,
				this.userinfo = userinfo
			}else{
				this.userlogin = false
				this.userinfo = {}
			}
		},
		
	}
</script>

<style>
@import url("./me.css");
</style>
